# -*- coding: latin-1 -*-
import datetime

def enc( cad ) :
    txt = ""
    for c in cad :
        txt += "%03d"%ord(c)
    return txt

def dec( cad ) :
    l = len(cad)/3
    txt = ""
    for i in range(l) :
        c = cad[i*3:i*3+3]
        txt += chr(int(c))
    return txt

def creaID() :
    d = datetime.datetime.now()
    s = "0,%s"%(d.isoformat()[2:].strip("0").replace("-","").replace("T","").replace(":","").replace(".",""))
    cr = enc(s)
    return cr

